<!-- 添加权限对话框 vue -->

<template>
	<div>
		<el-form :model="form.addActionFormInfo">

		    <el-form-item label="权限路径" :label-width="formLabelWidth" >
		      <el-cascader :options="dataList.selectActionList" change-on-select v-model="form.addActionFormInfo.action"></el-cascader>
		    </el-form-item>
			
			<el-form-item label="名称" :label-width="formLabelWidth" >
		      <el-input v-model="form.addActionFormInfo.name" ></el-input>
		    </el-form-item>

		    <el-form-item label="标志" :label-width="formLabelWidth" >
		      <el-input v-model="form.addActionFormInfo.flag" :label-width="formLabelWidth"></el-input>
		    </el-form-item>

		    <el-form-item label="备注" :label-width="formLabelWidth">
		      <el-input v-model="form.addActionFormInfo.mark" :label-width="formLabelWidth"></el-input>
		    </el-form-item>

		    
		  </el-form>
		  <div slot="footer" class="dialog-footer">
		    <el-button @click="closeDialog">取 消</el-button>
		    <el-button type="primary" @click="dialogBtnOk">确 定</el-button>
		  </div>
	</div>
</template>


<script>
import _http from '../common/http.vue'

export default{
	data(){
		return{
			dataList:{
				selectActionList:[]
			},
			form:{
				addActionFormInfo:{
					action:[],
					name:'',
					flag:'',
					mark:''
				}
			},
			formLabelWidth:'120px'
		}
	},
	mounted(){
		this.getSelectActionList()
	},
	methods:{
		closeDialog(){
			this.$emit('closeDialog')
		},
		dialogBtnOk(){
			_http.axiosRequest(this,'addActionInfo',{form:this.form.addActionFormInfo},(res)=>{
				if (_http.apiResult(this,res.data)) {
					this.closeDialog()
					this.$emit('freshList')
				}
			})
		},
		getSelectActionList(){
			_http.axiosRequest(this,'actionList',{type:'select'},(res)=>{
				this.dataList.selectActionList = res.data
			})
		},
	}
}
</script>

